﻿using SpaceNeedle.City6473.Web.Data.Models;
using System;
using System.Collections.Generic;
using System.Configuration;
using System.Linq;
using System.Web;
using System.Web.Mvc;

namespace SpaceNeedle.City6473.WebSite.Models
{
    public class UsersModel : UserModel
    {
        public UsersModel()
        {
            this.Users = new List<UsersAuthentication>();

            this.AvaliableRoles = new List<SelectListItem>();
            this.AvaliableRoles.Add(new SelectListItem { Text = "Administrador", Value = ConfigurationManager.AppSettings["adminRole"] });
            this.AvaliableRoles.Add(new SelectListItem { Text = "Usuário", Value = "Usuario" });
        }

        public List<UsersAuthentication> Users { get; set; }
        public List<SelectListItem> AvaliableRoles { get; set; }

        public string GetRoleName(string role)
        {
            return this.AvaliableRoles.Where(x => x.Value == role).SingleOrDefault().Text;
        }
    }
}